Repository navigation
SK-3253:Add gated retry on 401 status code for flowvault SDK - #454
Merged
Merged
Conversation
…01-retry SK-3253:Add gated retry on 401 status code for flowvault SDK.
|
✅ Gitleaks Findings: No secrets detected. Safe to proceed! |
|
Semgrep Findings: Issues with Error level severity are found (Error is Highest severity in Semgrep), Please resolve the issues before merging. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #454 +/- ##
============================================
+ Coverage 91.00% 91.29% +0.29%
- Complexity 0 571 +571
============================================
Files 174 174
Lines 7350 7401 +51
Branches 1013 1023 +10
============================================
+ Hits 6689 6757 +68
+ Misses 437 422 -15
+ Partials 224 222 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
saileshwar-skyflow
approved these changes
Oct 29, 2026
skyflow-bharti
approved these changes
Oct 29, 2026
skyflow-himanshupal
pushed a commit
that referenced
this pull request
Nov 10, 2026
* SK-3253:Add gated retry on 401 status code for both skyvault & flowvault SDKs. * SK-3253:Fix failed token regeneration when concurent 401 failures. * SK-3253:Update unit tests to cover both skyvault & flowvault. * SK-3252:Update null check. * [AUTOMATED] Private Release 1.2.0-dev-23391b03 * SK-3253:Update warning log & test. * [AUTOMATED] Private Release 1.2.0-dev-20ef0615 --------- Co-authored-by: yaswanth-pula-skyflow <yaswanth-pula-skyflow@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SK-3253: Retry once on
401when the bearer token expired mid-callTicket: SK-3253 (customer case CUST-4591)
Problem
Every vault method checks the bearer token once, at its start, with
now > exp. The token is then used for every HTTP request that method sends. If it expires while a request is in flight, or between the check and a later request of the same method, the gateway answers401and the SDK returns that as the result. Nothing regenerates the token until the next method call.In flowvault a bulk method splits records into batches and sends each batch as its own request under that one check. A customer's bulk tokenize of 2,000 records started a few seconds before expiry, passed the check, and lost every batch after
expas per-recordhttpCode=401errors.Fix
When a request fails with
401and the SDK can see from its own copy of the token that the token is at or past expiry, the SDK generates a new token once and resends that request once.401only. Any other status is returned as today.setToken) or an API key returns the401unchanged.expis within 60 seconds of now. A401on a token with more life than that is not expiry and is returned unchanged, with no token generated.401s on one token cost one generation.401is returned.Later requests in the same method read the refreshed token from the cache, so a bulk call that crosses expiry now completes in full. No new configuration. The start-of-method check is unchanged.
Changes
common
BaseVaultClient: the auth interceptor used by every OkHttp client now handles the401branch. NewrefreshBearerTokenAfterUnauthorizedimplements the rules above, synchronized withsetBearerToken. Token reads go through a synchronizedgetToken()so a token refreshed on one thread is seen by the others.Token.isExpiringWithin(token, windowSeconds): public, additive.isExpiredis unchanged.InfoLogs/WarningLogsentries for the refresh path. No new logging on the happy path.flowvault
VaultClient: uses the shared auth interceptor from common. The transport retry interceptor stays outside it, so configured 408/429/5xx retries and the call timeout still bound the whole exchange.skyvault
VaultClient: token supplier switched togetToken(). Vault and detect calls get the retry through the shared interceptor.401can come from the proxied third party, and a resend there is not guaranteed to be side-effect free.Not covered, by design
setTokentokens, API keys, any401on a token that is not near expiry, a connection call that straddles expiry. All behave exactly as today.Tests
BaseVaultClientTests(interceptor branches, gate, single-flight, same-token-back, failure),TokenTests(isExpiringWithinboundaries, malformed and missingexp).AuthInterceptorTests(retry ordering, resend once, static token and API key untouched).Token.isExpiringWithin.